<!--
 * @name warnUp
 * @description 组件描述
 * @author idouya
 * @email elegentfrog@163.com
 * @date 2025-07-01
 -->

<template>
  <div class="p-official common-bg common-layout">
    <page-title
      :discipline="gameInfo.discipline"
      :event="gameInfo.event"
      :match="gameInfo.match"
      :type="gameInfo.type"
    ></page-title>
    <div class="content">
      <div class="item" v-for="(item, index) in officialList" :key="index">
        <div class="item-top">
          <div class="position" v-if="item.Position">{{ item.Position }}</div>
          <div class="name">{{ item.OfficialName }}</div>
          <div class="delegation">{{ item.CountryName }}</div>
        </div>
        <img src="@/assets/img/scb/line-bg.png" alt="" height="8px" width="100%" />
      </div>
    </div>
  </div>
</template>

<script setup>
import Storage from '@/assets/js/storage'
import Utils from '@/assets/js/utils'
import PageTitle from '@/components/scb/PageTitle.vue'
import Config from '@/assets/js/config'
import { useMultiProcRequest } from '@/assets/js/useMultiProcRequest'

const { results, fetchForProcs } = useMultiProcRequest()

const { proxy } = getCurrentInstance()
const router = useRouter()
const route = useRoute()
const params = ref({})
const procName = ref([])

const gameInfo = ref({
  discipline: '马术',
  match: '',
  event: '',
  type: '裁判列表',
})

const officialList = ref([])

onBeforeMount(() => {})
onMounted(() => {
  params.value = route.query
  procName.value = Config.procNameList[route.name]
  getData()
})

const getData = async () => {
  if (procName.value.length > 0) {
    fetchForProcs(procName.value, {
      procName: procName.value[0],
      keyValues: params.value,
    })
  }
}

watchEffect(() => {
  if (results.value?.datasetList) {
    gameInfo.value.event = results.value.datasetList[0][0].EventCode
    gameInfo.value.match = results.value.datasetList[0][0].MatchName
    officialList.value = results.value.datasetList[1]
  }
})
</script>

<style scoped lang="scss">
@import '@/assets/scss/scb/official';
</style>
